<template>
<el-pagination
  v-bind="$attrs"
  v-on="$listeners"
  :layout="layout"
  @current-change="onPageChange"
  @size-change="onSizeChange"
/>
</template>

<script>
import { scrollTo } from 'utils/scroll-to'

export default {
  props: {
    layout: {
      type: String,
      default: 'sizes, prev, pager, next',
    },
  },

  methods: {
    onPageChange(currentPage) {
      scrollTo(0, 800)
      this.$emit('update:currentPage', currentPage)
    },

    onSizeChange(pageSize) {
      scrollTo(0, 800)
      this.$emit('update:pageSize', pageSize)
    },
  },
}
</script>

<style>

</style>
